﻿<UserControl x:Class="ModernUILogViewer.Pages.Statistics"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:content="clr-namespace:ModernUILogViewer.Content"             
             xmlns:conv="clr-namespace:ModernUILogViewer.Converters"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             DataContext="{Binding Source={StaticResource mainVM}, Path=StatisticsVM}"
             >

    <Grid Style="{StaticResource ContentRoot}">

        <Grid.Resources>
            <conv:IsEqualOrGreaterThanConverter x:Key="iseqgtconverter" />
            <conv:ConverterChain x:Key="nulltovisibilityconverter">
                <conv:NullToBooleanConverter />
                <BooleanToVisibilityConverter />
            </conv:ConverterChain>
        </Grid.Resources>

        <mui:ModernTab Layout="Tab" SelectedSource="../Content/ContentStatistics.xaml" DockPanel.Dock="Top">
            <mui:ModernTab.Style>
                <Style TargetType="{x:Type mui:ModernTab}">
                    <Setter Property="Visibility" Value="Collapsed"></Setter>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding AllEntriesKV.Count, TargetNullValue='0', Converter={StaticResource iseqgtconverter}, ConverterParameter='1'}" Value="True" >
                            <Setter Property="Visibility" Value="Visible"></Setter>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </mui:ModernTab.Style>
            <mui:ModernTab.Links>
                <mui:Link DisplayName="globals" Source="../Content/ContentStatistics.xaml" />
                <mui:Link DisplayName="interval" Source="../Content/ContentStatisticsInterval.xaml" />
            </mui:ModernTab.Links>
        </mui:ModernTab>
        
        <!--<DockPanel Visibility="{Binding AllEntriesKV, Converter={StaticResource nulltovisibilityconverter}, ConverterParameter='True'}">-->
        <DockPanel>
            <DockPanel.Style>
                <Style TargetType="{x:Type DockPanel}">
                    <Setter Property="Visibility" Value="Visible"></Setter>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding AllEntriesKV.Count, TargetNullValue='0', Converter={StaticResource iseqgtconverter}, ConverterParameter='1'}" Value="True" >
                            <Setter Property="Visibility" Value="Collapsed"></Setter>                        
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </DockPanel.Style>
            <TextBlock 
                HorizontalAlignment="Center"
                VerticalAlignment="Center" 
                Style="{StaticResource Fixed}">No data loaded</TextBlock>
        </DockPanel>
        
    </Grid>
</UserControl>
